package com.dyit.service.impl;

import com.dyit.entity.Category;
import com.dyit.mapper.ICategoryMapper;
import com.dyit.service.ICategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class CategoryServiceImpl implements ICategoryService {

    @Autowired
    private ICategoryMapper cm;
    @Override
    public void add(Category category) {
        cm.save(category);
    }

    @Override
    public void deleteById(int id) {
        cm.delete(id);
    }

    @Override
    public void update(Category category) {
        cm.update(category);
    }

    @Override
    public List<Category> findAll() {
        return cm.findAll();
    }
}
